<table class="table">
	<thead>
	<th>选择</th>
	<th>粉丝昵称</th>
	<th>
		<div class="input-group">
			<input name="keyword" class="form-control" value="{$_GPC['keyword']}" placeholder="请填写openid或昵称">
			<span class="input-group-btn">
				<button type="button" id="search" class="btn btn-default">搜索</button>
			</span>
		</div>
	</th>
	</thead>
	<tbody>
	{loop $fans $fan}
	{if !empty($fan['nickname'])}
	<tr>
		<td>
			<input name="openids" type="checkbox" id="keyword_{$fan['fanid']}" value="{$fan['openid']}"{if in_array($fan['openid'], $check_fans)}checked{/if}></label>
		</td>
		<td>
			<label for="keyword_{$fan['fanid']}">
			{$fan['nickname']}
			</label>
		</td>
		<td></td>
	</tr>
	{/if}
	</tbody>
	{/loop}
</table>
{$pager}
<script>
	require(['jquery'], function($) {
		$('[name="openids"]').click(function() {
			if ($(this).prop('checked')) {
				openids.push($(this).val());
			} else {
				delete openids[openids.indexOf($(this).val())];
			}
			var openid = new Array;
			var i = 0;
			for (var val in openids) {
				if (openids[val] != '') {
					openid[i] = openids[val];
					i++;
				}
			}
			openids = openid;
			document.cookie = 'fans_openids'+'{$_W['uniacid']}'+ '= '+JSON.stringify(openids);
			openidnum.html(openids.length);
		});
		$('.pagination a').click(function() {
			var page = $(this).attr('page');
			showFans(page, $('[name="keyword"]').val());
		});
		$('#search').click(function() {
			showFans(1, $('[name="keyword"]').val());
		});
	});

</script>

